﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using TyMES.Model;
using TyMES.Model.BaseInformation;

namespace TyMES.Model.BaseInformation
{
    /// <summary>
    /// 工位信息
    /// </summary>
	[Table("T_Stations")]
    [SoftKey(nameof(Station.StationCode))]
    [Display(Name = "_Model.Station")]
    public class Station : BasePoco,IPersistPoco
    {
        [Display(Name = "_Model._Station._StationCode")]
        [StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("工位编码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        // [CanNotEdit]
        public string StationCode { get; set; }
        [Display(Name = "_Model._Station._StationName")]
        [StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("工位名称")]
        public string StationName { get; set; }
        [Display(Name = "_Model._Station._Base_Status")]
        [Comment("工位状态")]
        public BaseStatusEnum? Base_Status { get; set; }
        [Display(Name = "_Model._Station._LineCode")]
        [Comment("产线信息")]
        [NotMapped]
        public Line LineCode { get; set; }
        [Display(Name = "_Model._Station._LineCode")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("产线信息")]
        public string LineCodeId { get; set; }
        [Display(Name = "_Model._Station._StationManagerID")]
        [Comment("工位负责人")]
        public string StationManagerID { get; set; }
        [Display(Name = "_Model._Station._StationManagerName")]
        [Comment("负责人姓名")]
        public string StationManagerName { get; set; }
        [Display(Name = "_Model._Machine._StationCode")]
        [InverseProperty("StationCode")]
        [NotMapped]
        [SoftFK(nameof(TyMES.Model.BaseInformation.Machine.StationCodeId))]
        public List<Machine> Machine_StationCode { get; set; }
        [Display(Name = "_Model._Person._StationCode")]
        [InverseProperty("StationCode")]
        [NotMapped]
        [SoftFK(nameof(TyMES.Model.BaseInformation.Person.StationCodeId))]
        public List<Person> Person_StationCode { get; set; }
        [Display(Name = "_Model._Station._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;

	}

}
